﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using ERP_RORZE_DLL.Product.database;
using ERP_RORZE_DLL.Product.DAO;

namespace ERP_RORZE.Product.PartHandling
{
    public partial class frm_HandInspInput : DevExpress.XtraEditors.XtraForm
    {
        public event EventHandler Reload;
        ClsDHandInspTable obj = new ClsDHandInspTable();
        ClsPartHandlingDAO clsParthandinhDAO = new ClsPartHandlingDAO();
        DataTable dt;
        public frm_HandInspInput()
        {
            InitializeComponent();
        }

        private void frm_HandInspInput_Load(object sender, EventArgs e)
        {
            //lấy danh sách MONo cho vào combo
            dt = clsParthandinhDAO.GetlAllMONo();
            cbMONo.DataSource = dt;
            cbMONo.DisplayMember = "MONo";
            cbMONo.ValueMember = "MONo";

            //lấy danh sách StaffID cho vào combo
            dt = clsParthandinhDAO.GetlAllStaffID();
            cbStaffID.DataSource = dt;
            cbStaffID.DisplayMember = "StaffID";
            cbStaffID.ValueMember = "StaffID";
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            obj.Date = dateDate.Value;
            obj.MONo = cbMONo.Text;
            obj.StaffID = cbStaffID.Text;
            obj.Finished = checkFinished.Checked;
            obj.NGQty = int.Parse(txtNGQty.Text);
            obj.OKQty = int.Parse(txtOKQty.Text);
            obj.Note = txtNote.Text;
            clsParthandinhDAO.InsertHandInspDetail(obj);
            Reload(sender, e);
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}